package cn.xjt.array;

import java.util.Arrays;

public class BubblingArray {
	public static void main(String[] args) {
		int[] a= {9,5,123,5,4,35,12,45,36};
		boolean flag=true;
		for(int j=0;j<a.length;j++)
		{
			for(int i=0;i<a.length-1-j;i++)
			{
				if(a[i]>a[i+1])
				{
					int temp=a[i];
					a[i]=a[i+1];
					a[i+1]=temp;
					flag=false;
				}
			}
			if(flag)
			{
				break;
			}
		}
		
		System.out.println(Arrays.toString(a));
		
	}
}
